package com.xpc.pojo.qin;

import com.xpc.pojo.MyClass;
import com.xpc.pojo.Student;
import com.xpc.pojo.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.ObjectUtils;

/**
 * @author Qinkuer
 * @version 1.0.0
 * @ProjectName UniversityGradeAdministrationSystem
 * @ClassName LoginUserInfo.java
 * @Description 用于登录返回用户个人信息
 * @createTime 2022年06月17日 11:28:00
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginUserInfo {
    private Long userId;
    private String nickname;
    private String headPortrait;
    private String name;
    private Integer gender;
    private Integer positionState;
    private Integer classId;
    private String className;

    public LoginUserInfo(User user,MyClass myClass){
        if(ObjectUtils.isEmpty(user)){
            return;
        }
        this.userId=user.getUserId();
        this.nickname= user.getNickname();
        this.headPortrait=user.getHeadPortrait();
        this.name=user.getName();
        this.gender=user.getGender();
        this.positionState=user.getPositionState();
        if(ObjectUtils.isEmpty(myClass)){
            return;
        }
        this.classId=myClass.getId();
        this.className=myClass.getName();
    }



}
